import { createRouter, createWebHashHistory } from 'vue-router'
import Chat from '@/views/Chat.vue'

const routes = [
  {
    path: '/',
    name: 'index',
    redirect: '/chat'
  },
  {
    path: '/chat',
    name: 'Chat',
    component: Chat,
    children: [
      {
        path: ':id',
        name: 'ChatMsg',
        component: () => import(/* webpackChunkName: "ChatMsg" */ '@/views/ChatMsg.vue')
      }
    ]
  },
  {
    path: '/users',
    name: 'Users',
    component: () => import(/* webpackChunkName: "Users" */ '@/views/Users.vue'),
    children: [
      {
        path: ':id',
        name: 'UserInfo',
        component: () => import(/* webpackChunkName: "UserInfo" */ '@/views/UserInfo.vue')
      }
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
